import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue()],
    resolve: {
        alias: {
            '@': path.resolve(__dirname, 'src'),
            'comps': path.resolve(__dirname, 'src/components'),
        },
    },
    server: {
        proxy: {
            '/api': {
                target: "http://web.juhe.cn:8080",
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, '')
            },
            '/test': {
                target: "http://127.0.0.1:7001",
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/test/, '')
            }
        }
    }
});

